﻿using UnityEngine;
using System.Collections;

public class Manager : MonoBehaviour {
    public static Manager currentManager;
    public static Manager loadingManager;

    private bool isFirstScene = false;

    public virtual void Awake() {
        Manager.loadingManager = this;

        if (Manager.currentManager == null)
        {
            Manager.currentManager = this;
            isFirstScene = true;
        }
    }

	// Use this for initialization
	public virtual void Start () {
        if (isFirstScene)
            StartCoroutine("Co_Start");
	}

    IEnumerator Co_Start()
    {
        yield return new WaitForEndOfFrame();
        StartScene();
    }
	
	// Update is called once per frame
	public virtual void Update () {
	
	}

    public virtual void StartScene()
    {
        Manager.currentManager = this;
    }
}
